<?php
include("connection/connection.php");
$typeScheme=$_POST['typeScheme'];
$frm=$_POST['frmId'];
if(isset($_POST['submit']))
{
$str=$_POST['str'];
$asset_id=$_POST['asset_id'];
$Discharge=$_POST['Discharge'];
$Head=$_POST['Head'];
$Power=$_POST['Power'];
$Status=$_POST['Status'];

$qr="update tbl_dtls_q1_asset set asset_location = '$_REQUEST[Location]' , asset_latitude = '$_REQUEST[Latitude]' , asset_longitude = '$_REQUEST[Longitude]' , asset_status='$Status',asset_discharge='$Discharge',asset_head='$Head',asset_power='$Power' where id='$asset_id'";
$res=mysql_query($qr);
//echo mysql_affected_rows();
//echo mysql_error();
////////////////////////code for maintaining user history///////////////////
	if($typeScheme=="P&T" || $typeScheme=="TSS(P&T)")
	{
		$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$frm','9','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
	}
	if($typeScheme=="Piped")
	{
		$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$frm','35','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
	}
	if($typeScheme=="Sanitary Diggs")
	{
		$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$frm','61','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
	}
	
	
	mysql_query($qryHistory);
	///////////////////////////////
	


if($res)
{
header("location:q1.php");
}
}		
?>